#include "historial.h"

void Make(Historial &historial){
    historial.prim = NULL;
    historial.ult = NULL;
}

void InsBack(Historial &historial, Consulta consulta){
    Lista nuevo = new Nodo;
    nuevo->info = consulta;
    nuevo->sig = NULL;
    if (historial.prim == NULL)
        historial.prim = nuevo;
    else
        historial.ult->sig = nuevo;
    historial.ult = nuevo;
}

bool Empty(Historial historial){
    return (bool)(historial.prim==NULL && historial.ult==NULL);
}

Consulta Front(Historial historial){
    return historial.prim->info;
}

void RemFront(Historial &historial){
    Lista aux = historial.prim->sig;
    delete (historial.prim);
    historial.prim = aux;
    if (historial.prim == NULL)
        historial.ult = NULL;
}

void ListarConsultas(Historial historial){
    while (historial.prim != NULL){
        DesplegarConsulta(historial.prim->info);
        printf("\n");
        historial.prim = historial.prim->sig;
    }
};
